import React from 'react'
import { Route, IndexRoute } from 'react-router'
import CoreLayout from 'layouts/CoreLayout'
// views must async load
import mainView from 'bundle?lazy!views/main'

const loadContainerAsync = bundle => (location, cb) => {
  bundle(component => {
    cb(null, component)
  })
}

export default (
  <Route component={CoreLayout} path="/">
    <IndexRoute getComponent={loadContainerAsync(mainView)} title="名称" />
    <Route getComponent={loadContainerAsync(mainView)} path="/main" title="main" />
  </Route>
)
